package com.wangyb.wework.service.contact;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wangyb.wework.entity.contact.WwContact;
import com.wangyb.wework.entity.contact.WwContactTrack;
import com.wangyb.wework.entity.employee.WwEmployee;
import com.wangyb.wework.enums.TrackEventEnum;
import com.wangyb.wework.mapper.contact.WwContactTrackMapper;
import org.springframework.stereotype.Service;

/**
 * 客户轨迹Service业务层处理
 *
 * @author wangyb
 * @date 2021-08-06
 */
@Service
public class WwContactTrackServiceImpl extends ServiceImpl<WwContactTrackMapper, WwContactTrack> implements IWwContactTrackService {

	@Override
	public void addTrack(Long corpId, TrackEventEnum event, WwContact contact, WwEmployee employee, String message){
		WwContactTrack track = new WwContactTrack();
		track.setCorpId(corpId);
		track.setEvent(event);
		track.setEmployeeId(employee.getId());
		track.setEmployeeWxUserid(employee.getWxUserId());
		track.setContactWxUserid(contact.getWxExternalUserid());
		track.setContactId(contact.getId());
		track.setMessage(message);
		this.save(track);
	}

}
